LandR Biomass module details

Biomass_regeneration

Required packages

## $Biomass_regeneration
## [1] "SpaDES.core"                         
## [2] "crayon"                              
## [3] "data.table"                          
## [4] "PredictiveEcology/LandR@development" 
## [5] "PredictiveEcology/pemisc@development"
## [6] "raster"

Parameters

paramName paramClass default min max paramDesc
calibrate logical FALSE NA NA Do calibration? Defaults to FALSE
fireInitialTime numeric NA NA NA The event time that the first fire disturbance event occurs
fireTimestep numeric NA NA NA The number of time units between successive fire events in a fire module
successionTimestep numeric 10 NA NA defines the simulation time step, default is 10 years

Input objects

objectName objectClass desc sourceURL
cohortData data.table age cohort-biomass table hooked to pixel group map by pixelGroupIndex at
succession time st ep NA
inactivePixelIndex logical internal use. Keeps track of which pixels are inactive NA
pixelGroupMap RasterLayer updated community map at each succession time step NA
rstCurrentBurn RasterLayer Binary raster of fires, 1 meaning ‘burned’, 0 or NA is non-burned NA
species data.table a table that has species traits such as longevity… https://raw.githubusercontent.com/LANDIS-II-Foundation/Extensions-Succession/master/biomass-succession-archive/trunk/tests/v6.0-2.0/species.txt
speciesEcoregion data.table table defining the maxANPP, maxB and SEP, which can change with both ecoregion and simulation time https://raw.githubusercontent.com/LANDIS-II-Foundation/Extensions-Succession/master/biomass-succession-archive/trunk/tests/v6.0-2.0/biomass-succession-dynamic-inputs_test.txt
studyArea SpatialPolygonsDataFrame multipolygon to use as the study area, with attribute LTHFC describing the fire return interval. Defaults to a square shapefile in Southwestern Alberta, Canada.
sufficientLight data.frame table defining how the species with different shade tolerance respond to stand shadeness https://raw.githubusercontent.com/LANDIS-II-Foundation/Extensions-Succession/master/biomass-succession-archive/trunk/tests/v6.0-2.0/biomass-succession_test.txt
treedFirePixelTableSinceLastDisp data.table 3 columns: pixelIndex, pixelGroup, and burnTime. Each row represents a forested pixel that was burned up to and including this year, since last dispersal event, with its corresponding pixelGroup and time it occurred NA

Output objects

objectName objectClass desc
cohortData data.table age cohort-biomass table hooked to pixel group map by pixelGroupIndex at succession time step
lastFireYear numeric Year of the most recent fire year
pixelGroupMap RasterLayer updated community map at each succession time step
serotinyResproutSuccessPixels numeric Pixels that were successfully regenerated via serotiny or resprouting. This is a subset of treedBurnLoci
postFireRegenSummary data.table summary table of species post-fire regeneration
treedFirePixelTableSinceLastDisp data.table 3 columns: pixelIndex, pixelGroup, and burnTime. Each row represents a forested pixel that was burned up to and including this year, since last dispersal event, with its corresponding pixelGroup and time it occurred

BiomassSpeciesData

Required packages

## $BiomassSpeciesData
##  [1] "SpaDES.core"                         
##  [2] "data.table"                          
##  [3] "gdalUtils"                           
##  [4] "googledrive"                         
##  [5] "magrittr"                            
##  [6] "PredictiveEcology/LandR@development" 
##  [7] "PredictiveEcology/pemisc@development"
##  [8] "pryr"                                
##  [9] "raster"                              
## [10] "reproducible"                        
## [11] "SpaDES.tools"

Parameters

paramName paramClass default min max paramDesc
sppEquivCol character Boreal NA NA The column in sim$specieEquivalency data.table to use as a naming convention
types character KNN NA NA The possible data sources. These must correspond to a function named paste0(‘prepSpeciesLayers_’, type)
vegLeadingProportion numeric 0.8 0 1 a number that define whether a species is leading for a given pixel
.plotInitialTime numeric NA NA NA This describes the simulation time at which the first plot event should occur
.plotInterval numeric NA NA NA This describes the simulation time interval between plot events
.saveInitialTime numeric NA NA NA This describes the simulation time at which the first save event should occur
.saveInterval numeric NA NA NA This describes the simulation time interval between save events
.useCache logical FALSE NA NA Should this entire module be run with caching activated? This is generally intended for data-type modules, where stochasticity and time are not relevant
.useParallel numeric 64 NA NA Used in reading csv file with fread. Will be passed to data.table::setDTthreads.

Input objects

objectName objectClass desc sourceURL
rasterToMatch RasterLayer Raster layer of buffered study area used for cropping, masking and projecting. Defaults to the kNN biomass map masked with studyArea http://tree.pfc.forestry.ca/kNN-StructureBiomass.tar
sppColorVect character A named vector of colors to use for plotting. The names must be in sim\(speciesEquivalency[[sim\)sppEquivCol]], and should also contain a color for ‘Mixed’ NA
sppEquiv data.table table of species equivalencies. See LandR::sppEquivalencies_CA.
studyArea SpatialPolygonsDataFrame Multipolygon to use as the study area. (studyArea is typically buffered to the actual study area of interest.) Defaults to an area in Southwestern Alberta, Canada. NA
studyAreaReporting SpatialPolygonsDataFrame multipolygon (typically smaller/unbuffered than studyArea) to use for plotting/reporting. Defaults to an area in Southwestern Alberta, Canada. NA

Output objects

objectName objectClass desc
speciesLayers RasterStack biomass percentage raster layers by species in Canada species map
treed data.table one logical column for each species, indicating whether there were non-zero values
numTreed numeric a named vector with number of pixels with non-zero cover values
nonZeroCover numeric A single value indicating how many pixels have non-zero cover

Boreal_LBMRDataPrep

Required packages

## $Boreal_LBMRDataPrep
##  [1] "SpaDES.core"                         
##  [2] "achubaty/amc@development"            
##  [3] "crayon"                              
##  [4] "data.table"                          
##  [5] "dplyr"                               
##  [6] "fasterize"                           
##  [7] "gdalUtils"                           
##  [8] "lme4"                                
##  [9] "plyr"                                
## [10] "PredictiveEcology/LandR@development" 
## [11] "PredictiveEcology/pemisc@development"
## [12] "raster"                              
## [13] "rgeos"                               
## [14] "sp"

Parameters

paramName paramClass default min max paramDesc
biomassModel call lme4::lmer(B ~ logAge * speciesCode + cover * speciesCode + (logAge + cover + speciesCode | ecoregionGroup)) NA NA Model and formula for estimating biomass (B) from ecoregionGroup (currently ecoDistrict * LandCoverClass), speciesCode, logAge (gives a downward curving relationship), and cover. Defaults to a LMEM, which can be slow if dealing with very large datasets (e.g. 36 000 points take 20min). For faster fitting try P(sim)$subsetDataBiomassModel == TRUE, or quote(RcppArmadillo::fastLm(formula = B ~ logAge * speciesCode * ecoregionGroup + cover * speciesCode * ecoregionGroup)). A custom model call can also be provided, as long as the ‘data’ argument is NOT included.
coverModel call lme4::glmer(cbind(coverPres, coverNum) ~ speciesCode + (1 | ecoregionGroup), family = binomial) NA NA Model and formula used for estimating cover from ecoregion and speciesCode and potentially others. Defaults to a GLMEM if there are > 1 grouping levels. A custom model call can also be provided, as long as the ‘data’ argument is NOT included
forestedLCCClasses numeric c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 32, 34, 35) 0 39 The classes in the rstLCC layer that are ‘treed’ and will therefore be run in LBMR.
Defau lts to forest ed classes in LCC2005 map.
LCCClassesToReplaceNN numeric 34:35 NA NA This will replace these classes on the landscape with the closest forest class P(sim)$forestedLCCClasses. If the user is using the default 2005 data product for rstLCC, then users may wish to include 36 (cities – if running a historic range of variation project), and 34:35 (burns) Since this is about estimating parameters for growth, it doesn’t make any sense to have unique estimates for transient classes in most cases
omitNonTreedPixels logical TRUE FALSE TRUE Should this module use only treed pixels, as identified by P(sim)$forestedLCCClasses?
pixelGroupAgeClass numeric params(sim)\(Boreal_LBMRDataPrep\)successionTimestep NA NA When assigning pixelGroup membership, this defines the resolution of ages that will be considered ‘the same pixelGroup’, e.g., if it is 10, then 6 and 14 will be the same
pixelGroupBiomassClass numeric 100 NA NA When assigning pixelGroup membership, this defines the resolution of biomass that will be considered ‘the same pixelGroup’, e.g., if it is 100, then 5160 and 5240 will be the same
runName character NA NA A description for run. This will form the basis of cache path and output path, and affect dispersal parameterization.
speciesUpdateFunction list list(LandR::speciesTableUpdate(sim\(species, sim\)speciesTable, sim\(sppEquiv, P(sim)\)sppEquivCol)) NA NA Unnamed list of quoted functions that updates species table to customize values.
Defau lt should alw ays come first.
sppEquivCol character Boreal NA NA The column in sim$specieEquivalency data.table to use as a naming convention
subsetDataAgeModel numeric NULL NA NA the number of samples to use when subsampling the biomass data model; if TRUE, uses 50
subsetDataBiomassModel numeric NULL NA NA the number of samples to use when subsampling the biomass data model; if TRUE, uses 50
successionTimestep numeric 10 NA NA defines the simulation time step, default is 10 years
useCloudCacheForStats logical TRUE NA NA Some of the statistical models take long (at least 30 minutes, likely longer). If this is TRUE, then it will try to get previous cached runs from googledrive
.plotInitialTime numeric NA NA NA This describes the simulation time at which the first plot event should occur
.plotInterval numeric NA NA NA This describes the simulation time interval between plot events
.saveInitialTime numeric NA NA NA This describes the simulation time at which the first save event should occur
.saveInterval numeric NA NA NA This describes the simulation time interval between save events
.useCache logical init NA NA Controls cache; caches the init event by default

Input objects

objectName objectClass desc sourceURL
cloudFolderID character The google drive location where cloudCache will store large statistical objects NA
columnsForPixelGroups character The names of the columns in cohortData that define unique pixelGroups. Default is c(‘ecoregionGroup’, ‘speciesCode’, ‘age’, ‘B’) NA
ecoDistrict SpatialPolygonsDataFrame ecodistricts in study area, default is Canada national ecodistricts http://sis.agr.gc.ca/cansis/nsdb/ecostrat/district/ecodistrict_shp.zip
rstLCC RasterLayer A land classification map in study area. It must be ‘corrected’, in the sense that:
1) Every class must not conflict with any other ma p in this module
(e.g., speciesLayer s should not have data in L CC classes that are non-treed);
2) It can have treed an d non-treed classes. The no n-treed will be removed within this
module if P(sim)$om itNonTreedPixels is TRUE;
3) It can have transien t pixels, such as ’young fi re’. These will be converted to a
the nearest non-tra nsient class, probabilistic ally if there is more than 1 nearest
neighbour class, ba sed on P(sim)$LCCClassesToR eplaceNN.
The default layer used, if not supplied, is Canada national land classification in 2005 https://drive.google.com/file/d/1g9jr0VrQxqxGjZ4ckF6ZkSMP-zuYzHQC/view?usp=sharing
rasterToMatch RasterLayer DESCRIPTION NEEDED NA
rawBiomassMap RasterLayer total biomass raster layer in study area, default is Canada national biomass map http://tree.pfc.forestry.ca/kNN-StructureBiomass.tar
speciesLayers RasterStack cover percentage raster layers by species in Canada species map http://tree.pfc.forestry.ca/kNN-Species.tar
speciesTable data.table species attributes table, default is from Dominic Cyr and Yan Boulanger’s project https://raw.githubusercontent.com/dcyr/LANDIS-II_IA_generalUseFiles/master/speciesTraits.csv
sppColorVect character named character vector of hex colour codes corresponding to each species
sppEquiv data.table table of species equivalencies. See LandR::sppEquivalencies_CA.
studyArea SpatialPolygonsDataFrame multipolygon to use as the study area, with attribute LTHFC describing the fire return interval. Defaults to a square shapefile in Southwestern Alberta, Canada.
studyAreaLarge SpatialPolygonsDataFrame multipolygon (larger area than studyArea) to use for parameter estimation, with attribute LTHFC describing the fire return interval. Defaults to a square shapefile in Southwestern Alberta, Canada.
standAgeMap RasterLayer stand age map in study area, default is Canada national stand age map http://tree.pfc.forestry.ca/kNN-StructureStandVolume.tar

Output objects

objectName objectClass desc
biomassMap RasterLayer total biomass raster layer in study area, filtered for pixels covered by cohortData
cohortData data.table initial community table, created from available biomass, age and species cover data, as well as eco zonation information
ecoDistrict
ecoregion data.table ecoregion look up table
ecoregionMap RasterLayer ecoregion map that has mapcodes match ecoregion table and speciesEcoregion table
pixelGroupMap RasterLayer initial community map that has mapcodes match initial community table
minRelativeB data.frame define the cut points to classify stand shadeness
species data.table a table that has species traits such as longevity…
speciesEcoregion data.table define the maxANPP, maxB and establishprob change with both ecoregion and simulation time
studyArea
sufficientLight data.frame define how the species with different shade tolerance respond to stand shadeness

LBMR

Required packages

## $LBMR
##  [1] "SpaDES.core"                               
##  [2] "compiler"                                  
##  [3] "data.table"                                
##  [4] "dplyr"                                     
##  [5] "fpCompare"                                 
##  [6] "ggplot2"                                   
##  [7] "grid"                                      
##  [8] "PredictiveEcology/LandR@development"       
##  [9] "PredictiveEcology/pemisc@development"      
## [10] "PredictiveEcology/reproducible@development"
## [11] "PredictiveEcology/SpaDES.core@development" 
## [12] "PredictiveEcology/SpaDES.tools@development"
## [13] "purrr"                                     
## [14] "quickPlot"                                 
## [15] "raster"                                    
## [16] "Rcpp"                                      
## [17] "scales"                                    
## [18] "sp"                                        
## [19] "tidyr"

Parameters

paramName paramClass default min max paramDesc
calcSummaryBGM character end NA NA A character vector describing when to calculate the summary of biomass, growth and mortality Currently any combination of 5 options is possible: ‘start’- as before vegetation succession events, i.e. before dispersal, ‘postDisp’ - after dispersal, ‘postRegen’ - after post-disturbance regeneration (currently the same as ‘start’), ‘postGM’ - after growth and mortality, ‘postAging’ - after aging, ‘end’ - at the end of vegetation succesion events, before plotting and saving. The ‘end’ option is always active, being also the default option.
calibrate logical FALSE NA NA Do calibration? Defaults to FALSE
growthAndMortalityDrivers character LandR NA NA package name where the following functions can be found: calculateClimateEffect, assignClimateEffect
growthInitialTime numeric start(sim) NA NA Initial time for the growth event to occur
initialBiomassSource character cohortData NA NA Currently, there are three options: ‘spinUp’, ‘cohortData’, ‘biomassMap’. If ‘spinUp’, it will derive biomass by running spinup derived from Landis-II. If ‘cohortData’, it will be taken from the ‘cohortData’ object, i.e., it is already correct, by cohort. If ‘biomassMap’, it will be taken from sim\(biomassMap, divided across species using sim\)speciesLayers percent cover values spinUp uses sim$ageMap as the driver, so biomass is an output. That means it will be unlikely to match any input information about biomass, unless this is set to TRUE, and a `sim$rawBiomassMap`` is supplied.
mixedType numeric 2 NA NA How to define mixed stands: 1 for any species admixture; 2 for deciduous > conifer. See ?vegTypeMapGenerator.
seedingAlgorithm character wardDispersal NA NA choose which seeding algorithm will be used among noDispersal, universalDispersal, and wardDispersal (default).
spinupMortalityfraction numeric 0.001 NA NA defines the mortality loss fraction in spin up-stage simulation
sppEquivCol character Boreal NA NA The column in sim$specieEquivalency data.table to use as a naming convention
successionTimestep numeric 10 NA NA defines the simulation time step, default is 10 years. Note that growth and mortality always happen on a yearly basis.
vegLeadingProportion numeric 0.8 0 1 a number that define whether a species is leading for a given pixel
.maxMemory numeric 5 NA NA maximum amount of memory (in GB) to use for dispersal calculations.
.plotInitialTime numeric 0 NA NA Vector of length = 1, describing the simulation time at which the first plot event should occur. Set to NA to turn plotting off.
.plotInterval numeric NA NA NA defines the plotting time step. If NA, the default, .plotInterval is set to successionTimestep.
.plotMaps logical TRUE NA NA Controls whether maps should be plotted or not
.saveInitialTime numeric NA NA NA Vector of length = 1, describing the simulation time at which the first save event should occur. Set to NA if no saving is desired. If not NA, then saving will occur at .saveInitialTime with a frequency equal to .saveInterval
.saveInterval numeric NA NA NA defines the saving time step. If NA, the default, .saveInterval is set to successionTimestep.
.useCache logical init NA NA Controls cache; caches the init event by default
.useParallel ANY 2 NA NA Used only in seed dispersal. If numeric, it will be passed to data.table::setDTthreads and should be <= 2; If TRUE, it will be passed to parallel:makeCluster; and if a cluster object, it will be passed to parallel::parClusterApplyB.

Input objects

objectName objectClass desc sourceURL
biomassMap RasterLayer total biomass raster layer in study area, filtered for pixels covered by cohortData. Only used if P(sim)$initialBiomassSource == ‘biomassMap’
cohortData data.table Columns: B, pixelGroup, speciesCode, Indicating several features about ages and current vegetation of stand NA
ecoregion data.table ecoregion look up table https://raw.githubusercontent.com/LANDIS-II-Foundation/Extensions-Succession/master/biomass-succession-archive/trunk/tests/v6.0-2.0/ecoregions.txt
ecoregionMap RasterLayer ecoregion map that has mapcodes match ecoregion table and speciesEcoregion table. Defaults to a dummy map matching rasterToMatch with two regions NA
minRelativeB data.frame table defining the cut points to classify stand shadeness NA
pixelGroupMap RasterLayer initial community map that has mapcodes match initial community table NA
rasterToMatch RasterLayer Raster layer of buffered study area used for cropping, masking and projecting. Defaults to the kNN biomass map masked with studyArea http://tree.pfc.forestry.ca/kNN-StructureBiomass.tar
species data.table a table that has species traits such as longevity, shade tolerance, etc. Default is partially based on Dominic Cir and Yan’s project https://raw.githubusercontent.com/dcyr/LANDIS-II_IA_generalUseFiles/master/speciesTraits.csv
speciesEcoregion data.table table defining the maxANPP, maxB and SEP, which can change with both ecoregion and simulation time. Defaults to a dummy table based on dummy data os biomass, age, ecoregion and land cover class NA
sppColorVect character A named vector of colors to use for plotting. The names must be in sim\(speciesEquivalency[[sim\)sppEquivCol]], and should also contain a color for ‘Mixed’ NA
sppEquiv data.table table of species equivalencies. See LandR::sppEquivalencies_CA.
studyArea SpatialPolygonsDataFrame multipolygon to use as the study area, with attribute LTHFC describing the fire return interval. Defaults to a square shapefile in Southwestern Alberta, Canada.
studyAreaReporting SpatialPolygonsDataFrame multipolygon (typically smaller/unbuffered than studyArea) to use for plotting/reporting. Defaults to an area in Southwestern Alberta, Canada. NA
sufficientLight data.frame table defining how the species with different shade tolerance respond to stand shadeness. Default is based on LANDIS-II Biomass Succession v6.2 parameters https://raw.githubusercontent.com/LANDIS-II-Foundation/Extensions-Succession/master/biomass-succession-archive/trunk/tests/v6.0-2.0/biomass-succession_test.txt
treedFirePixelTableSinceLastDisp data.table 3 columns: pixelIndex, pixelGroup, and burnTime. Each row represents a forested pixel that was burned up to and including this year, since last dispersal event, with its corresponding pixelGroup and time it occurred

Output objects

objectName objectClass desc
activePixelIndex integer internal use. Keeps track of which pixels are active
activePixelIndexReporting integer internal use. Keeps track of which pixels are active in the reporting study area
ANPPMap RasterLayer ANPP map at each succession time step
cohortData data.table age cohort-biomass table hooked to pixel group map by pixelGroupIndex at succession time step
inactivePixelIndex logical internal use. Keeps track of which pixels are inactive
inactivePixelIndexReporting integer internal use. Keeps track of which pixels are inactive in the reporting study area
lastFireYear numeric Year of the most recent fire year
lastReg numeric an internal counter keeping track of when the last regeneration event occurred
minRelativeB data.frame define the cut points to classify stand shadeness
mortalityMap RasterLayer Mortality map at each succession time step
pixelGroupMap RasterLayer updated community map at each succession time step
regenerationOutput data.table TODO: description needed
reproductionMap RasterLayer Regeneration map at each succession time step
simulatedBiomassMap RasterLayer Biomass map at each succession time step
simulationOutput data.table contains simulation results by ecoregion (main output)
simulationTreeOutput data.table Summary of several characteristics about the stands, derived from cohortData
species data.table a table that has species traits such as longevity, shade tolerance, etc. Currently obtained from LANDIS-II Biomass Succession v.6.0-2.0 inputs
speciesEcoregion data.table define the maxANPP, maxB and SEP change with both ecoregion and simulation time
spinupOutput data.table Spin-up output
summaryBySpecies data.table The total species biomass, average age and aNPP across the landscape (used for plotting and reporting).
summaryBySpecies1 data.table No. pixels of each leading vegetation type (used for plotting and reporting).
summaryLandscape data.table The averages of total biomass, age and aNPP across the landscape (used for plotting and reporting).
treedFirePixelTableSinceLastDisp

LandR module integration

modules_landr <- c("BiomassSpeciesData", modules3[c(1, 2, 4)])

mySim_landr <- Cache(simInit,
                     times = times,
                     params = parameters3,
                     modules = modules_landr,
                     outputs = outputs3,
                     objects = objects3,
                     paths = paths3,
                     loadOrder = unlist(modules_landr),
                     useCloud = FALSE,
                     cloudFolderID = cloudCacheFolderID,
                     omitArgs = c("debug", "paths", ".plotInitialTime")
)

png(file.path("docs", "LandR_module_diagram.png"), height = 800, width = 800)
  moduleDiagram(mySim_landr)
dev.off()

## currently not working: see https://github.com/rich-iannone/DiagrammeR/issues/207
## workaround is to use Rstudio's manual export ability :S
objectDiagram(mySim_landr, height = 2500, width = 1250) # %>%
#   DiagrammeRsvg::export_svg() %>%
#   charToRaw() %>%
#   rsvg::rsvg() %>%
#   png::writePNG(file.path("docs", "LandWeb_object_diagram.png"))